package com.example.demo.information.service.impl;

import com.example.demo.information.entity.Bjxx;
import com.example.demo.information.repository.BjxxRepository;
import com.example.demo.information.service.BjxxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author littlecar
 * @date 2020/3/23 15:19
 */
@Service
public class BjxxServiceImpl implements BjxxService {
    @Autowired
    private BjxxRepository bjxxRepository;

    @Override
    public List<Bjxx> findByNameLike(String name) {
        return bjxxRepository.findByNameLike(name);
    }

    @Override
    public List<Bjxx> findPageByNameLike(String name, int pages, Integer limit) {
        return bjxxRepository.findPageByNameLike(name, pages, limit);
    }

    @Override
    public List<Bjxx> findAll() {
        return bjxxRepository.findAll();
    }

    @Override
    public List<Bjxx> findPageAll(int pages, Integer limit) {
        return bjxxRepository.findPageAll(pages, limit);
    }

    @Override
    public List<Bjxx> findByName(String name) {
        return bjxxRepository.findByName(name);
    }

    @Override
    public Bjxx findById(Long id) {
        return bjxxRepository.findById(id).get();
    }

    @Override
    public List<Bjxx> findByBjbh(String bjbh) {
        return bjxxRepository.findByBjbh(bjbh);
    }

    @Override
    public void save(Bjxx bjxx) {
        bjxxRepository.save(bjxx);
    }

    @Override
    public void deleteById(Long bjId) {
        bjxxRepository.deleteById(bjId);
    }

    @Override
    public List<Bjxx> findBySchoolIdAndBzrId(Long school_id, Long old_bzrId) {
        return bjxxRepository.findBySchoolIdAndBzrId(school_id, old_bzrId);
    }

}
